<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>易渔 - 购物车</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link rel="icon" href="assets/logo/logo.png">
</head>

<body class="bg-gray-100 min-h-screen">
    <div id="particles-js" class="fixed inset-0 z-0"></div>

    <!-- 导航栏 -->
    <nav class="bg-gradient-to-r from-blue-700 to-blue-500 text-white shadow-lg relative z-10">
        <div class="container mx-auto px-4 py-3">
            <div class="flex flex-wrap justify-between items-center">
                <div class="flex items-center">
                    <img src="assets/logo/logo.png" alt="易渔" style="width: 30px;height: 40px;">
                    <a href="index.html" class="text-2xl font-bold">易渔</a>
                </div>
                <div class="hidden md:flex space-x-8 text-lg">
                    <a href="index.html" class="hover:text-blue-200 transition duration-300">首页</a>
                    <a href="forum.html" class="hover:text-blue-200 transition duration-300">论坛</a>
                    <a href="mall.html" class="hover:text-blue-200 transition duration-300">商城</a>
                    <a href="#" class="hover:text-blue-200 transition duration-300" id="communityBtn">社区活动</a>
                    <a href="#" class="hover:text-blue-200 transition duration-300" id="techniqueBtn">钓技研究</a>
                </div>
                <div class="flex items-center">
                    <a href="cart.html" class="mr-4 relative border-b-2 border-white">
                        <i class="fas fa-shopping-cart text-xl"></i>
                        <span id="cart-count"
                            class="absolute -top-2 -right-2 bg-red-500 text-white rounded-full h-5 w-5 flex items-center justify-center text-xs">0</span>
                    </a>
                    <div id="user-auth-section">
                        <a href="auth.html"
                            class="bg-white text-blue-600 hover:bg-blue-100 px-4 py-2 rounded-lg font-medium transition duration-300">登录/注册</a>
                    </div>
                    <div id="user-info-section" class="hidden">
                        <div class="flex items-center">
                            <img id="user-avatar" src="https://picsum.photos/40/40" alt="用户头像"
                                class="w-8 h-8 rounded-full mr-2">
                            <span id="username" class="font-medium"></span>
                            <button id="logout-btn" class="ml-3 text-sm text-blue-200 hover:text-white">退出</button>
                        </div>
                    </div>
                    <button id="mobile-menu-btn" class="md:hidden ml-4">
                        <i class="fas fa-bars text-2xl"></i>
                    </button>
                </div>
            </div>
            <!-- 移动端菜单 -->
            <div id="mobile-menu" class="hidden md:hidden w-full mt-3">
                <a href="index.html" class="block py-2 hover:bg-blue-600 px-2 rounded">首页</a>
                <a href="forum.html" class="block py-2 hover:bg-blue-600 px-2 rounded">论坛</a>
                <a href="mall.html" class="block py-2 hover:bg-blue-600 px-2 rounded">商城</a>
                <a href="#" class="block py-2 hover:bg-blue-600 px-2 rounded">社区活动</a>
                <a href="#" class="block py-2 hover:bg-blue-600 px-2 rounded">钓技研究</a>
            </div>
        </div>
    </nav>

    <!-- 购物车内容区域 -->
    <div class="container mx-auto px-4 py-8 relative z-10">
        <h1 class="text-3xl font-bold mb-8 text-gray-800">我的购物车</h1>

        <!-- 购物车为空提示 -->
        <div id="empty-cart" class="hidden bg-white rounded-lg shadow-md p-10 text-center">
            <div class="flex flex-col items-center justify-center">
                <i class="fas fa-shopping-cart text-6xl text-gray-300 mb-4"></i>
                <h2 class="text-xl font-bold text-gray-600 mb-2">您的购物车是空的</h2>
                <p class="text-gray-500 mb-6">去逛逛商城，添加一些钓鱼好装备吧！</p>
                <a href="mall.html"
                    class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg transition duration-300">
                    <i class="fas fa-shopping-bag mr-2"></i>浏览商城
                </a>
            </div>
        </div>

        <!-- 购物车内容 -->
        <div id="cart-content" class="mb-8">
            <!-- 购物车表头 -->
            <div
                class="hidden md:flex bg-white rounded-t-lg shadow-md p-4 font-medium text-gray-700 border-b border-gray-200">
                <div class="w-2/5">商品信息</div>
                <div class="w-1/5 text-center">单价</div>
                <div class="w-1/5 text-center">数量</div>
                <div class="w-1/5 text-center">小计</div>
            </div>

            <!-- 购物车商品列表 -->
            <div id="cart-items" class="bg-white md:rounded-none rounded-lg shadow-md divide-y divide-gray-200">
                <!-- 购物车项目将由JavaScript动态生成 -->
            </div>

            <!-- 购物车底部 -->
            <div class="bg-white rounded-b-lg shadow-md p-4 md:p-6">
                <div class="flex flex-col md:flex-row justify-between items-center">
                    <div class="flex flex-col md:flex-row items-center mb-4 md:mb-0">
                        <button id="clear-cart"
                            class="flex items-center text-gray-500 hover:text-red-600 transition mr-0 md:mr-6 mb-3 md:mb-0">
                            <i class="fas fa-trash mr-1"></i>
                            <span>清空购物车</span>
                        </button>
                        <a href="mall.html" class="flex items-center text-blue-600 hover:text-blue-800 transition">
                            <i class="fas fa-arrow-left mr-1"></i>
                            <span>继续购物</span>
                        </a>
                    </div>
                    <div class="flex flex-col md:flex-row items-center">
                        <div class="text-lg md:mr-6 mb-4 md:mb-0">
                            <span class="mr-2">合计:</span>
                            <span id="cart-total" class="text-2xl font-bold text-red-600">¥0.00</span>
                        </div>
                        <button id="checkout-btn"
                            class="bg-red-600 hover:bg-red-700 text-white px-8 py-3 rounded-lg transition duration-300">
                            <i class="fas fa-credit-card mr-2"></i>
                            结算
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <!-- 猜你喜欢 -->
        <div class="mt-12">
            <h2 class="text-2xl font-bold mb-6 text-gray-800">猜你喜欢</h2>
            <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6" id="recommended-products">
                <!-- 推荐商品将由JavaScript动态生成 -->
            </div>
        </div>
    </div>

    <!-- 确认清空购物车弹窗 -->
    <div id="confirm-clear-modal"
        class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg p-6 max-w-md w-full mx-4">
            <h3 class="text-xl font-bold mb-4">确认清空购物车?</h3>
            <p class="text-gray-600 mb-6">此操作将清空购物车中的所有商品，且不可恢复。</p>
            <div class="flex justify-end space-x-4">
                <button id="cancel-clear"
                    class="px-4 py-2 bg-gray-200 hover:bg-gray-300 rounded transition duration-300">取消</button>
                <button id="confirm-clear"
                    class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded transition duration-300">确认清空</button>
            </div>
        </div>
    </div>

    <!-- 结算提示弹窗 -->
    <div id="checkout-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg p-6 max-w-md w-full mx-4">
            <div class="text-center">
                <i class="fas fa-info-circle text-4xl text-blue-500 mb-4"></i>
                <h3 class="text-xl font-bold mb-2">功能开发中</h3>
                <p class="text-gray-600 mb-6">支付功能正在积极开发中，敬请期待！</p>
                <button id="close-checkout-modal"
                    class="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded transition duration-300">
                    了解
                </button>
            </div>
        </div>
    </div>

    <!-- 通知弹窗 -->
    <div id="notification"
        class="fixed bottom-4 right-4 bg-green-500 text-white p-4 rounded-lg shadow-lg transform translate-y-20 opacity-0 transition-all duration-300 z-50 hidden">
        操作成功
    </div>

    <!-- 页脚 -->
    <footer class="bg-gray-800 text-white py-8 mt-12">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h4 class="text-lg font-bold mb-4">关于我们</h4>
                    <p class="text-gray-400">钓鱼天堂是一个致力于为钓鱼爱好者提供交流平台和专业装备的综合性网站。</p>
                </div>
                <div>
                    <h4 class="text-lg font-bold mb-4">快速链接</h4>
                    <ul class="space-y-2 text-gray-400">
                        <li><a href="index.html" class="hover:text-white transition">首页</a></li>
                        <li><a href="forum.html" class="hover:text-white transition">论坛</a></li>
                        <li><a href="mall.html" class="hover:text-white transition">商城</a></li>
                        <li><a href="auth.html" class="hover:text-white transition">注册/登录</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-lg font-bold mb-4">联系我们</h4>
                    <ul class="space-y-2 text-gray-400">
                        <li><i class="fas fa-envelope mr-2"></i> contact@fishingheaven.com</li>
                        <li><i class="fas fa-phone mr-2"></i> 400-123-4567</li>
                        <li><i class="fas fa-map-marker-alt mr-2"></i> 渔乐路88号钓鱼天堂大厦</li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-lg font-bold mb-4">关注我们</h4>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-weixin"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-weibo"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-qq"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-tiktok"></i></a>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-8 pt-6 text-center text-gray-400">
                <p>&copy; 2025 钓鱼天堂 版权所有 | 钓友们的网上家园</p>
            </div>
        </div>
    </footer>

    <!-- 粒子效果 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/particles.js/2.0.0/particles.min.js"></script>
    <script src="js/app.js"></script>
    <script src="js/mall.js"></script>
    <script type="module" src="./js/childJS/cartChild.js"></script>
</body>

</html>